home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November / PCWK1103B.iso / DesignCAD 3D Max PLUS trial 30 / DATA1.CAB / Example_Files / Sample_Macros / Text Select.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  1.4 KB  |  56 lines

  1. ' This simple macro prompts the user for a text string, then searches through the drawing 
  2. ' looking for that string.  If a match is found, the matching piece of text is selected.
  3. ' It not, a message is displayed.  Note that this program only finds the first instance
  4. ' of the text string within the drawing, then quits.  Both 2D and 3D text strings are tested.
  5. '
  6. ' Deselect everything before starting
  7.     Sys(80) = 0
  8. '
  9. ' Un-remark these next 2 lines to make the input box appear in the upper 
  10. ' left corner of the DesignCAD window, so it does not cover the drawing area.
  11.     ' Sys(130) = 5
  12.     ' Sys(131) = 5
  13. ' Get Text String from user
  14.     Input "Enter Text to Search For . . .", TextStr$
  15. '
  16. ' Find total number of entities
  17.     count = sys(9)            
  18. ' Cycle through all entities
  19.     For i = 1 To count           
  20.     ' Get each entity
  21.         Entity(i)            
  22.     ' Determine Entity Type
  23.         etype = Sys(90)            
  24.     ' If its 2-D text
  25.         if etype=13 then         
  26.             Cur$ = Sys$(1)     
  27.             ' If there is a match
  28.             if Cur$ = TextStr$ then goto break
  29.         endif
  30.     ' If its 3-D text
  31.         if etype=3 then         
  32.             Cur$ = Sys$(1)     
  33.             ' If there is a match
  34.             if Cur$ = TextStr$ then goto break2
  35.         endif
  36.     ' Loop back to next Entity
  37.     next a
  38. Message "No Matching Text String Found in the drawing."
  39. End
  40. '
  41. Break:
  42. ' Select text
  43.     putattr i, 13, 1    
  44. >Regenerate
  45. {
  46. }
  47. End
  48. '
  49. Break2:
  50. ' Select text
  51.     putattr i, 3, 1    
  52. >Regenerate
  53. {
  54. }
  55. End
  56.